﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TCCHWLib
{
    public class PriorityKey: IComparable<PriorityKey>
    {
        private int m_Phase = -1;
        private int m_Sequence = -1;

        public int Phase
        {
            get { return m_Phase; }
            set { m_Phase = value; }
        }
        public int Sequence
        {
            get { return m_Sequence; }
            set { m_Sequence = value; }
        }

        public PriorityKey()
        {
            m_Phase = int.MaxValue;
            m_Sequence = int.MaxValue;
        }
        public PriorityKey(int phase, int sequence)
        {
            m_Phase = phase;
            m_Sequence = sequence;
        }

        #region IComparable<PriorityKey> Members

        public int CompareTo(PriorityKey other)
        {
            if (this.Phase < other.Phase)
                return -1;

            if (this.Phase > other.Phase)
                return 1;

            if (this.Sequence < other.Sequence)
                return -1;

            if (this.Sequence > other.Sequence)
                return 1;

            return 0;
        }

        #endregion

        public override string ToString()
        {
            return String.Format("[{0},{1}]", m_Phase, m_Sequence);
        }
    }
}
